/**
 * 
 */
package org.cuatrovientos.exercise5dice;

import java.util.Random;

/**
 * @author David Berrade
 *
 */
public class Dice {
	
	private int sides=6;
	
	private boolean canBeZero = true;
	
	public Dice (){
		
		sides=6;
	}
	
	public Dice (int sides){
		this.sides=sides;
	
	}
	
	public Dice (int sides, boolean canBeZero) {
		this.sides=sides;
		this.canBeZero=canBeZero;
	
	}
	
	/**
	 * This is when you roll the dice
	 * @return
	 */
	public int roll(){
		
		Random random= new Random();
		
		if (canBeZero){
			return random.nextInt(sides);
		}
		else{
			 sides=random.nextInt(sides);
			if (this.sides==0){
				return sides+1; 
				
			}
			return sides;
		}
		
		
		
	}
		
		
	
	
	

}
